import { createApp } from 'vue'

import TitleI18n from '@/components/Basic/title-il8n/index.vue'
import SvgIcon from '@/components/SvgIcon/index.vue'
import App from './App.vue'

import '@/router/permission'

import { createTheme } from '@/utils/Theme'

// import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './styles/index.scss'
import 'virtual:uno.css'
import 'virtual:svg-icons-register'
import { setupI18n } from './locales'
import router from './router'
// import { createPinia } from 'pinia'
import { setupStore } from './store'

// 初始化主题
createTheme().init()

import ElementPlus from 'element-plus'

import 'vform3-builds/dist/designer.style.css'
import { useIcons } from '@/plugins/ElementIcons'
import VForms from 'vform3-builds'

const app = createApp(App)

const setupPlugins = () => {
  useIcons(app)
  app.component('SvgIcon', SvgIcon)
  app.component('TitleI18n', TitleI18n)

  app.use(ElementPlus)

  app.use(VForms)
}

const setupApp = async () => {
  setupStore(app)
  app.use(router)
  await setupI18n(app)
}

setupPlugins()
setupApp()

app.mount('#app')
